/*!\file  math.h  The math code.
 *
 *      This file is part of the micro-rtos package.
 *
 *      This program is free software; you can redistribute it and/or
 *      modify it under the terms of the GNU General Public License
 *      as published by the Free Software Foundation; either version
 *      2 of the License, or (at your option) any later version.
 */


#ifndef __MATH_H
#define __MATH_H

/*
Long integer arithmetics
	- division
	- modulo

ported from standard C library by:
	Gabriel Zabusek
*/

#define divnorm(num, den, sign) 		\
{						\
  if (num < 0) 					\
    {						\
      num = -num;				\
      sign = 1;					\
    }						\
  else 						\
    {						\
      sign = 0;					\
    }						\
						\
  if (den < 0) 					\
    {						\
      den = - den;				\
      sign = 1 - sign;				\
    } 						\
}

unsigned long divmodsi4(int modwanted, unsigned long num, unsigned long den);
long __modsi3 (long numerator, long denominator);
long __divsi3 (long numerator, long denominator);
long __umodsi3 (unsigned long numerator, unsigned long denominator);
long __udivsi3 (unsigned long numerator, unsigned long denominator);


#endif
